home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / edit / me_cd25.zip / MUTT2.ZIP / WSCROLL.MUT < prev    next >
Text File  |  1992-11-09  |  1KB  |  42 lines

  1.   ;; wscroll.mut : horzontal window scrolling
  2.   ;; scroll-right, scroll-left
  3.   ;;   Manually scroll the current window horizontally.
  4.   ;;   Trys to keep the cursor on screen to prevent the update routines
  5.   ;;     from undoing the scroll.
  6.   ;; cursor-is-right, cursor-is-left
  7.   ;;   Shift the window so that the cursor is at the right or left
  8.   ;;     margin (if possible).
  9.   ;; center-screen-around-cursor-horizontally
  10.   ;; C Durland    Public Domain
  11.  
  12. (defun
  13.   scroll-right
  14.   {
  15.     (int n)
  16.  
  17.     (window-ledge -1 (- (window-ledge -1) (arg-prefix)))
  18.     (n (+ (window-ledge -1)(screen-width)))
  19.     (if (>= (current-column) n) (current-column n))
  20.   }
  21.   scroll-left
  22.   {
  23.     (int n)
  24.  
  25.     (n (window-ledge -1 (+ (window-ledge -1) (arg-prefix))))
  26.     (if (<= (current-column) n)(current-column (+ n 1)))
  27.   }
  28.     ;; Shift the screen left so that the cursor is in the left most
  29.     ;;   visible column.
  30.   cursor-is-left { (window-ledge -1 (- (current-column) 2)) }
  31.     ;; Shift the screen right so that the cursor is in the right most
  32.     ;;   visible column.
  33.   cursor-is-right { (window-ledge -1 (- (current-column) (screen-width) -1)) }
  34.   center-screen-around-cursor-horizontally
  35.     { (window-ledge -1 (- (current-column) (/ (screen-width) 2))) }
  36.   MAIN
  37.   {
  38.     (bind-to-key "cursor-is-left"  "C-x<")
  39.     (bind-to-key "cursor-is-right" "C-x>")
  40.   }
  41. )
  42.